from not_so_free_marker.enums import MarkTypeEnum, VarTypeEnum, FileOpResultEnum


class RegMatch(object):
    def __init__(self):  # 构造函数
        self.position = 0
        self.position_end = 0
        self.type = None
        self.tagStr = ""

    @staticmethod
    def sort_rule(s):
        return s.position


class RegMatchListHead(RegMatch):
    def __init__(self):  # 构造函数
        self.type = MarkTypeEnum.REG_LIST_HEAD
        self.collection = ""
        self.item = ""
        self.index = ""


class RegMatchVar(RegMatch):
    def __init__(self):
        self.var = ""
        self.funcs = []
        self.vars = []
        self.type = MarkTypeEnum.REG_VAR


class RegMatchInclude(object):
    def __init__(self):  # 构造函数
        self.type = MarkTypeEnum.REG_INCLUDE
        self.file_path = ""


class RegMatchIf(object):
    def __init__(self):
        self.type = MarkTypeEnum.REG_IF_HEAD
        self.express = ""  # 表达式


#################################

class Variant():
    def __init__(self, _type: VarTypeEnum, _content: str):
        self.type = _type
        self.content = _content
